<template>
    <ul>
        <li v-for="item in goodsList" :key="item.id" @click="productdetail(item.id)">
            <img :src="item.list_pic_url" style="display:block;" width="100%" alt="" />
            <div class="van-ellipsis">{{item.name}}</div>
            <!-- 全局写过滤器 -->
            <div class="price">{{item.retail_price | RMBformat}}</div>
        </li>
    </ul>
</template>

<script>
export default {
  props: ['goodsList'],
  data() {
    return {

    }
  },
  methods: {
    // 商品的id
    productdetail(id) {
      this.$router.push('/productdetail?id=' + id)
      // console.log(id)
      setTimeout(() => {
        this.$router.go(0)
      }, 10)
    }
  }
}
</script>

<style lang = "less" scoped>
ul{
    padding: .1rem 2%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    li{
        width: 49%;
        margin-bottom: .1rem;
        background: #fff;
        text-align: center;
        line-height: .3rem;
        .price{
            color: darkred;
        }
    }
}
</style>
